<?php
/*
 * @Author: your name
 * @Date: 2020-10-27 14:31:14
 * @LastEditTime: 2020-10-29 10:31:27
 * @LastEditors: Please set LastEditors
 * @Description: 函谷盾模块
 * @FilePath: /special/application/adminapiv3/service/module_manage/HgshieldModuleRelationService.php
 */
namespace app\adminapiv3\service\module_manage\hgshield;

use app\common\service\asset_manage\host\Host;
use app\common\service\HostNormalRuleGroupRelation;
use app\common\service\HostNormalRuleRelation;
use app\common\service\IpsConfig;
use app\adminapiv3\service\module_manage\ModuleRelationService;

class HgshieldModuleRelationService extends ModuleRelationService
{
    public $module = 'hgshield';
    /**
     * @name: 添加
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-10-27 14:32:43
     */
    public function add ()
    {
        $host_id_a = $this->getHost('id');

        $HostNormalRuleGroupRelation = new HostNormalRuleGroupRelation();
        $HostNormalRuleRelation = new HostNormalRuleRelation();
        $IpsConfig = new IpsConfig();
        $Host = new Host();

        foreach ($host_id_a as $host_id)
        {
            $HostNormalRuleGroupRelation->add($host_id);
            $HostNormalRuleRelation->add($host_id);
            $ipsConfigData['host_id'] = $host_id;
            $ipsConfigData['protect_ip'] = $Host->GetHostIp($host_id);
            $IpsConfig->add($ipsConfigData);
        }
    }

    /**
     * @name: 删除
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-10-27 14:32:56
     */
    public function del ()
    {
        
    }

    /**
     * @name: 冲突字段
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-10-28 14:17:59
     */
    public function conflictField (&$Host)
    {
        $Host->where('netfilter','<>',1);
    }

    /**
     * @name: 冲突模块
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-10-28 15:23:03
     */
    public function conflictModule ()
    {
        return [
            'netfilter',
        ];
    }
}